<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <title>用户登录</title>
    <link rel="stylesheet" href="/css/index.css"/>
    <link href="/css/bootstrap.min.css" rel="stylesheet">
    <link href="/css/font-awesome.css" rel="stylesheet">
    <link href="/css/datatables.min.css" rel="stylesheet">
    <link href="/css/animate.css" rel="stylesheet">
    <link href="/css/style.css" rel="stylesheet">
    <script type="text/javascript" src="/js/jquery.js"></script>
    <script type="text/javascript" src="/js/jquery-3.1.1.min.js"></script>
    <script type="text/javascript" src="/js/vue.js"></script>
</head>
<body>
<div class="divright">
    <div class="login" id="dl">
        <h2>XX酒店管理系统</h2>
        <div class="login_box">

            <input type="text" name="userName" required="required" v-model="user.sysName"/><label>用户名</label>
        </div>
        <div class="login_box">
            <input type="password" name="password" required="required" v-model="user.sysPwd"/><label>密码</label>
        </div>
        <button class="button" @click="login">
            登录
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </button>
    </div>
</div>

<!-- Mainly scripts -->
<script type="text/javascript" src="/js/jquery-3.1.1.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/jquery.metisMenu.js"></script>
<script src="/js/jquery.slimscroll.min.js"></script>
<script src="/js/datatables.min.js"></script>
<script src="/js/inspinia.js"></script>
<script src="/js/pace.min.js"></script>
</body>
<script>


    new Vue({
        el: "#dl",
        data: {
            user: {
                sysName: "",
                sysPwd: ""
            }
        },
        methods: {
            login: function () {
                var self = this;
                $.ajax({
                    url: "/userReful/login",
                    type: "post",
                    contentType: "application/x-www-form-urlencoded",
                    data: self.user,
                    dataType: "json",
                    success: function (data) {
                        console.log(data);
                        alert(data.info);
                        if (data.info == "登录成功") {
                            window.location.href = "/admin/indexPage" ;
                        }
                    }
                })
            }
        }
    })
</script>
</html>
